using System;
using System.Collections.Generic;
using System.Text;

namespace DotNetX
{
    /// <summary>
    /// This exception logs the error also
    /// </summary>
    public class DotNetXException : Exception
    {
        public DotNetXException(string message)
            : base(message)
        {
            // log the error
            this.LogError();
        }

        /// <summary>
        /// This logs the exception with the option of sending an E-Mail to support
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="sendEmail"></param>
        public static void LogException(Exception ex)
        {
            if (ex == null)
                throw new DotNetXException("'ex' is null.");

            //// log the error
            //TmoError.Create(ex.Message,
            //                ex.Source,
            //                ex.StackTrace,
            //                (ex.InnerException == null) ? string.Empty :
            //                    ex.InnerException.Message,
            //                Guid.Empty,
            //                string.Empty,
            //                string.Empty,
            //                string.Empty,
            //                0,
            //                ex.Data);
        }

        /// <summary>
        /// This logs an error to the database
        /// </summary>
        /// <param name="tmoException"></param>
        public void LogError()
        {
            //// log the error
            //TmoError.Create(this.Message,
            //                this.Source,
            //                this.StackTrace,
            //                (this.InnerException == null) ? string.Empty :
            //                    this.InnerException.Message,
            //                Guid.Empty,
            //                string.Empty,
            //                string.Empty,
            //                string.Empty,
            //                this.HResult,
            //                this.Data,
            //                true);
        }
    }
}
